import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Layout',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Column 垂直布局'),
        ),
        body: Column(
          // 主轴排列方式，同flex布局  start/center/end/spaceEvenly/spaceBetween/spaceAround
          mainAxisAlignment: MainAxisAlignment.end,
          // 主轴最大尺寸 max（默认值）/min
          mainAxisSize: MainAxisSize.max,
          // 交叉轴排列方式，同flex布局  start/center/end/stretch/baseline
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: (){},
              child: const Text('黄色')
            ),
            Expanded(
              // Expanded相当于弹性布局，可以设置flex,不设置时拿能拿大最大值
              flex: 0,
              child: ElevatedButton(
                onPressed: (){},
                child: const Text('红色红色红色红色')
              ),
            ),
            ElevatedButton(
              onPressed: (){},
              child: const Text('白色')
            ),
          ],
        ),
      ),
    );
  }
}
